package _23.simpleFactor;

//苹果工厂
public class AppleFactory {

    public static ApplePhone createPhone(String model) {
        ApplePhone applePhone = null;
        switch (model) {
            case "iPhoneX":
                applePhone = new IphoneX();
                break;
            case "iPhoneXs":
                applePhone = new IphoneXs();
                break;
            case "iPhoneXr":
                applePhone = new IphoneXR();
                break;
            default:
                break;
        }
        return applePhone;
    }

    public static void main(String[] args) {
        ApplePhone applePhone;
        applePhone = AppleFactory.createPhone("iPhoneX");
        applePhone.getSize();
        applePhone = AppleFactory.createPhone("iPhoneXs");
        applePhone.getSize();
        applePhone = AppleFactory.createPhone("iPhoneXr");
        applePhone.getSize();
    }
}